<table width="100%"><tr><td width="20%">
<a href="../index.html">&lt; index</a><br />
<a href="index.html">&lt; 8. All purposes container</a><br />
<a href="list_iterator.html">&lt; 8.5 Iterators</a>
</td><td width="60%">
<p align="center">
=====================================<br />
8.6 Deleting a list<br />
=====================================<br />
</p></td><td width="20%">
</td></tr></table>
<style type="text/css">
.code { color:#444444; background-color:#EEEEEE;}
pre { color:#444444; background-color:#EEEEEE;}
table.param td { border : 1px solid #000000; }
th { background-color: #44BBFF; color: #FFFFFF }
table.none td { border : 0 }
</style>
You can delete a list, freeing any allocated resources. Note that deleting the list does not delete it's elements. You have to use <a href="list_list.html">clearAndDelete</a> before deleting the list if you want to destroy the elements too.<br />
<p class="code"><pre>
C++ : virtual template &lt;class T&gt; TCODList::~TCODList()
C   : void TCOD_list_delete(TCOD_list_t l)
</pre></p>
<table class="param">
<tr><th>Parameter</th><th>Description</th></tr>
<tr><td>l</td><td>In the C version, the list handler, returned by <a href="list_init.html">a constructor</a>.</td></tr>
</table>
<br />
Example :<br />
<p class="code"><pre>
C++ : TCODList&lt;int&gt; *intList = new TCODList&lt;int&gt;(); // allocate a new empty list
      intList-&gt;push(5); // the list contains 1 element at position 0, value = 5
      delete intList; // destroy the list
C   : TCOD_list_t intList = TCOD_list_new();
      TCOD_list_push(intList,(const void *)5);
      TCOD_list_delete(intList);
</pre></p>

